import { _decorator, Component, Node, EditBox} from 'cc';
import {AccountModule} from "db://assets/scripts/modules/login/core/AccountModule";
const { ccclass, property } = _decorator;

@ccclass('LoginPanelUI')
export class LoginPanelUI extends Component {

    @property(Node)
    accountNameInput: Node = null;
    @property(Node)
    passwordInput: Node = null;


    // 点击登录按钮
    onClickLoginButton() {
        let accountName = this.accountNameInput.getComponent(EditBox).string;
        let password = this.node.getChildByName("PasswordInput").getComponent(EditBox).string;
        AccountModule.getInstance().accountLogin(accountName, password);
    }

    // 点击注册按钮
    onClickRegisterButton() {
        let accountName = this.accountNameInput.getComponent(EditBox).string;
        let password = this.passwordInput.getComponent(EditBox).string;
        AccountModule.getInstance().accountRegister(accountName, password);
    }

}


